#include "mselection.h"

#include <QPainter>

MSelection::MSelection(QGraphicsItem *parent) :
    QGraphicsWidget(parent)
{
}

void MSelection::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
{
    if (r < l)
        return;
    QPen k;
    k.setColor(QColor(0, 155, 155));
    k.setWidth(3);
    p->setPen(k);
    p->drawRect(l, u, r - l, d - u);
}

void MSelection::updateGeometry(int x1, int y1, int x2, int y2)
{
    l = x1;
    r = x2;
    u = y1;
    d = y2;
    update();
}
